<?php
/**
 * quick_curd
 * ============================================================================
 * 版权所有 2024-2099 www.wltx666.com，并保留所有权利。
 * 网站地址: https://www.wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wei@alipay16.cn
 * QQ: 2719875001
 * Date: 2025/11/11
 * 描述:
 */

namespace app\admin\controller;

use app\service\UpdateService;
use think\App;

class Update extends BaseAdmin
{
    protected $objService;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->objService = new  UpdateService();
    }

    //应用更新http://qc.test.top/admin/update/index
    public function index()
    {
        return $this->view('update/index');
    }

    //上传应用
    public function upload_app()
    {
        $res = $this->objService->upload_app($this->param);
        data_exit_json($res);
    }

    //开始更新
    public function start_update()
    {
        $this->param['admin_id'] = $this->admin_id;
        $res = $this->objService->start_update($this->param);
        data_exit_json($res);
    }

    //取消更新
    public function cancel_update()
    {
        $res = $this->objService->cancel_update($this->param);
        data_exit_json($res);
    }

    //获取当前版本
    public function get_current_version()
    {
        $res = $this->objService->get_current_version($this->param);
        data_exit_json($res);
    }

    //获取更新历史记录
    public function get_update_history()
    {
        $res = $this->objService->get_update_history($this->param);
        data_exit_json($res);
    }
}
